import dayjs from "dayjs";

export const orderColumns = [
  {
    prop: "name",
    label: "名称",
    width: "200px",
  },
  {
    prop: "name2",
    label: "名称2",
    width: "200px",
  },
  {
    prop: "name3",
    label: "名称3",
  },
  {
    prop: "name4",
    label: "名称4",
  },
  {
    prop: "name5",
    label: "名称5",
  },
  {
    prop: "name6",
    label: "名称6",
  },
  {
    prop: "name47",
    label: "名称47",
  },
  {
    prop: "img",
    label: "产品小图",
    type: "img",
  },
  {
    prop: "flag",
    label: "是否启用",
    width: "90px",
    render(row: any) {
      return h(
        "div",
        {
          style: {
            color: row.flag === 1 ? "green" : "red",
            fontWeight: "bold",
          },
        },
        row.flag === 1 ? "启用" : "禁用"
      );
    },
  },
  {
    prop: "status",
    label: "状态",
    render(row: any) {
      const statusMap = {
        0: { text: "待处理", color: "orange" },
        1: { text: "进行中", color: "blue" },
        2: { text: "已完成", color: "green" },
        3: { text: "已取消", color: "gray" },
      };
      return h(
        "el-tag",
        {
          type: statusMap[row.status]?.color || "info",
        },
        statusMap[row.status]?.text || "未知"
      );
    },
  },
  {
    prop: "date",
    label: "日期",
    width: "130px",
    render(row: any) {
      return h(
        "div",
        {
          style: {
            color: "#666",
            fontSize: "12px",
          },
        },
        dayjs(row.date).format("YYYY-MM-DD HH:mm")
      );
    },
  }
];
